package cn.yunhe.action;

import cn.yunhe.model.User;
import com.opensymphony.xwork2.ActionSupport;
import net.sf.json.JSONObject;

/**
 * Created by zs on 2017/11/22.
 */
public class JsonAction extends ActionSupport {
    private String json;
    private User user;

    public String testJson1() {
        user = new User();
        user.setUserName("张三");
        user.setPassWord("123");
        JSONObject jsonObject = JSONObject.fromObject(user);
        String jsonStr = jsonObject.toString();
        System.out.println(jsonStr);
        json = jsonStr;
        return "test1";
    }

    public String getJson() {
        return json;
    }

    public void setJson(String json) {
        this.json = json;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }
}
